package com.lagou.wwyan.rpc.server.factory;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

public class SpringRpcBeanFactory implements RpcBeanFactory, ApplicationContextAware {
    private ApplicationContext context;

    @Override
    public <T> T getBean(Class<T> tClass) throws NoSuchMethodException, Exception {
        return context.getBean(tClass);
    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        context = applicationContext;
    }
}
